from db.conn_redis import connect_to_redis


def basic_operations():
    client = connect_to_redis()
    """Redis 基本操作"""
    if client is None:
        print("Redis 客户端未初始化")
        return

    # 设置键值对
    client.set('test', 'test')
    print("设置键值对: test -> test")

    # 获取键值对
    test = client.get('test')
    print(f"获取键值对: test -> {test}")

    # 删除键
    client.delete('test')
    print("删除键: test")

    # 检查键是否存在
    exists = client.exists('test')
    print(f"键 'test' 是否存在: {exists}")
